package cn.stylefeng.guns.modular.carIndustryPlan.controller;

import cn.stylefeng.guns.modular.carIndustryPlan.pojo.request.CarIndustryPlanRequest;
import cn.stylefeng.guns.modular.carIndustryPlan.service.CarIndustryPlanService;
import cn.stylefeng.guns.modular.classicCase.pojo.request.ClassicCaseRequest;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 汽车行业解决方案控制器
 *
 * @author liuxue
 * @date 2022/01/10 15:06
 */
@RestController
@ApiResource(name = "汽车行业解决方案")
public class CarIndustryPlanController {

    @Resource
    private CarIndustryPlanService carIndustryPlanService;

    /**
     * 添加
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @PostResource(name = "添加", path = "/carIndustryPlan/add")
    public ResponseData add(@RequestBody @Validated(CarIndustryPlanRequest.add.class) CarIndustryPlanRequest carIndustryPlanRequest) {
        carIndustryPlanService.add(carIndustryPlanRequest);
        return new SuccessResponseData();
    }

    /**
     * 删除
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @PostResource(name = "删除", path = "/carIndustryPlan/delete")
    public ResponseData delete(@RequestBody @Validated(CarIndustryPlanRequest.delete.class) CarIndustryPlanRequest carIndustryPlanRequest) {
        carIndustryPlanService.del(carIndustryPlanRequest);
        return new SuccessResponseData();
    }

    /**
     * 编辑
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @PostResource(name = "编辑", path = "/carIndustryPlan/edit")
    public ResponseData edit(@RequestBody @Validated(CarIndustryPlanRequest.edit.class) CarIndustryPlanRequest carIndustryPlanRequest) {
        carIndustryPlanService.edit(carIndustryPlanRequest);
        return new SuccessResponseData();
    }

    /**
     * 查看详情
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @GetResource(name = "查看详情", path = "/carIndustryPlan/detail")
    public ResponseData detail(@Validated(CarIndustryPlanRequest.detail.class) CarIndustryPlanRequest carIndustryPlanRequest) {
        return new SuccessResponseData(carIndustryPlanService.detail(carIndustryPlanRequest));
    }

    /**
     * 获取列表
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @GetResource(name = "获取列表", path = "/carIndustryPlan/list")
    public ResponseData list(CarIndustryPlanRequest carIndustryPlanRequest) {
        return new SuccessResponseData(carIndustryPlanService.findList(carIndustryPlanRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author liuxue
     * @date 2022/01/10 15:06
     */
    @GetResource(name = "分页查询", path = "/carIndustryPlan/page")
    public ResponseData page(CarIndustryPlanRequest carIndustryPlanRequest) {
        return new SuccessResponseData(carIndustryPlanService.findPage(carIndustryPlanRequest));
    }

    /**
     * 修改状态
     *
     * @author liuxue
     * @date 2022/01/10 16:44
     */
    @PostResource(name = "修改状态", path = "/carIndustryPlan/changeStatus")
    public ResponseData changeStatus(@RequestBody @Validated(CarIndustryPlanRequest.edit.class) CarIndustryPlanRequest carIndustryPlanRequest) {

        carIndustryPlanService.edit(carIndustryPlanRequest);
        return new SuccessResponseData();
    }

}